export const setQuickBtns = (btns, menu, editor, editorRef) => {
  if (btns.length > 0) {
    menu.insert.items += ' | quickbtns'
    const items: any = []
    btns.forEach(item => {
      const obj = {
        type: 'menuitem',
        text: item.text,
        onAction: () => {
          editorRef.insertContent('【【' + item.type + '=' + item.key + '】】')
        }
      }
      items.push(obj)
    })
    // 添加菜单栏下拉按钮
    editor.ui.registry.addNestedMenuItem('quickbtns', {
      icon: 'addtag',
      text: '快速输入',
      getSubmenuItems: () => items
    })
    // 添加工具栏下拉按钮
    editor.ui.registry.addMenuButton('quickbtns', {
      icon: 'addtag',
      tooltip: '快速输入',
      fetch: callback => {
        callback(items)
      }
    })
  }
}
